<?php
	
	class RegisterView {
		
		private $confButton = "confButton";
		private $passWord = "passWord";
		private $secPassWord = "secPassWord";
		private $userName = "userName";	
		
		public function NewUser() {		
			return "
				<form method='post'>
					<div id='registerForm'>
						<p>Username:</p>
						<p><input type='text' name='$this->userName' /></p>
						<p>Password:</p>
						<p><input type='password' name='$this->passWord' /></p>
						<p>Password again:</p>
						<p><input type='password' name='$this->secPassWord' /></p>
						<p><button name='$this->confButton' class='button'>Sign up</button></p>
					</div>
				</form>";
		}
		
		public function Success() {
			return "
				<div id='successReg'>
					<p class='successText'>You are now registered.</p>
				</div>";
		}
		
		public function NoUsername() {
			return "
				<div id='wrongDiv'>
					<p class='wrongMessage'>Username can't be NULL.</p>
				</div>";
		}
		
		public function UsernameExists() {
			return "
				<div id='wrongDiv'>
					<p class='wrongMessage'>Username already exists.</p>
				</div>";
		}
		
		public function SamePassword() {
			return "
				<div id='wrongDiv'>
					<p class='wrongMessage'>Passwords doesn't match.</p>
				</div>";
		}
		
		public function ShortPassword() {
			return "
				<div id='wrongDiv'>
					<p class='wrongMessage'>Password must contain at least 6 characters, 
					one number and start with capital letter.</p>
				</div>";
		}
		
		//Hämtar användare och lösenord.
		public function UserName() {		
			if (isset($_POST[$this->userName]) == true) {
				return $_POST[$this->userName];
			}	
			return false;
		}
		
		public function PassWord() {
			if (isset($_POST[$this->passWord]) == true) {
				return $_POST[$this->passWord];
			}		
			return false;
		}
		
		public function PassWordTwo() {
			if (isset($_POST[$this->secPassWord]) == true) {
				return $_POST[$this->secPassWord];
			}		
			return false;
		}
		
		//Hämtar conf-knappen.
		public function ConfButton() {
			if (isset($_POST[$this->confButton]) == true) {
				return true;
			}		
			return false;
		}
	}
